<?php
defined( 'BASEPATH' ) or exit( 'No direct script access allowed' );
class User_model extends MY_Model
{
    function get_list_count()
    {
        $this->_db->select( $this->_table, 'count(*)' );
        $this->_db->where( '`deleted`=0' );
        return ( int ) $this->_db->fetch_cell();
    }
    function get_list($length = 10, $begin = 0)
    {
        $this->_db->select( $this->_table, '`id`,`enable`,`username`,`password`,`mobile`,`email`,`role_id`,`nickname`,`picture`' );
        $this->_db->where( '`deleted`=0' );
        $this->_db->order( '`id` desc' );
        $this->_db->limit( $length, $begin );
        return $this->_db->fetch_all();
    }
    function get($id)
    {
        $this->_db->select( $this->_table );
        $this->_db->where( '`id`=? and `deleted`=0', $id );
        $this->_db->limit( 1 );
        return $this->_db->fetch_row();
    }
}